
package date;

import java.util.Calendar;
import java.util.Date;

/**
 * 設定時間於早上八點, 如果現在時間超過早上八點, 則設為次日的八點<br>
 * <br>
 * Copyright: Copyright (c) 2001-2007<br>
 * Company: 一零四資訊科技股份有限公司
 * 
 * @author Eric.Kao(eric.kao@104.com.tw)
 * @version 1.0
 */
public class SetFixedTime
{
	public SetFixedTime()
	{
		Calendar calendar = Calendar.getInstance();

		int dayOfYear = calendar.get( Calendar.DAY_OF_YEAR );
		int hourOfDay = calendar.get( Calendar.HOUR_OF_DAY );

		if( hourOfDay >= 8 )
		{
			calendar.set( Calendar.DAY_OF_YEAR, dayOfYear + 1 );
		}

		calendar.set( Calendar.HOUR_OF_DAY, 8 );
		calendar.set( Calendar.MINUTE, 0 );
		calendar.set( Calendar.SECOND, 0 );

		Date date = calendar.getTime();

		System.out.println( date );
	}

	public static void main( String[] args )
	{
		SetFixedTime setfixedtime = new SetFixedTime();
	}
}
